var arrKuangWu=[];
var arrMouse=[];
//关卡数据
var arr_zhonglei=[
                  [1,1,1,1,1,1,1,1,1,1,2,2,2,2,3],
                  [1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,4,3],
                  [1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,4],
                  [1,1,1,1,1,1,1,1,1,2,2,2,2,3,3,5,6,6],
                  [1,1,1,1,1,1,1,1,1,2,2,2,2,3,6,6,4,4,4,4],
                  [1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,3,5,5,5,5],
                  [1,1,1,1,1,3,6,6,6,6,6,6,8,8,9,9,7,7],
                  
                  [1,1,1,1,1,1,1,4,3,6,6,5,6,6,5,8,8,9,9,7,7],
                  [3,3,4,4,4,4,4,4,4,4,5,5,5,7,7,7,7,7],
                  [1,3,3,3,3,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,7,7]
                 
                  ];
var arr_daxiao=[
                [1,1,0.25,0.25,0.25,0.1,0.1,0.1,0.1,0.1,1,1,0.6,0.6,1],
                [1,1,0.25,0.25,0.25,0.1,0.1,0.1,0.1,0.1,1,1,1,1,0.6,0.6,1,1],
                [1,0.25,0.25,0.25,0.1,0.1,0.1,0.1,1,1,1,1,0.5,0.5,0.5,1,1],
                [0.5,0.5,0.2,0.2,0.2,0.1,0.1,0.1,0.1,1,1,1,0.6,1,1,1,1,1],
                [1,1,0.5,0.2,0.2,0.2,0.1,0.1,0.1,1,1,1,0.5,1,1,1,1,1,1,1],
                [1,0.2,0.2,0.2,0.1,0.1,0.1,0.1,0.1,0.1,0.1,1,1,1,0.5,0.5,0.5,1,1,1,1,1],
                [1,1,1,0.8,0.8,1,1,1,1,1,1,1,1,1,1,1,1,1],
                
                [1,1,1,0.8,0.8,0.5,0.2,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
                [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
                [0.5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
                ];
var arr_jiazhi=[
                [500,500,500,500,500,500,500,500,500,500,20,20,20,20,100],
                [500,500,500,500,500,500,500,500,500,500,20,20,20,20,20,20,600,100],
                [500,500,500,500,500,500,500,500,20,20,20,20,20,20,20,100,600],
                [500,500,500,500,500,500,500,500,500,20,20,20,20,100,100,602,2,2],
                [500,500,500,500,500,500,500,500,500,20,20,20,20,600,2,2,600,600,600,600],
                [500,500,500,500,500,500,500,500,500,500,500,20,20,20,20,20,20,100,602,602,602,602],
                [500,500,500,500,500,100,2,2,2,2,2,2,-515,-515,7,7,0,0],
                
                [500,500,500,500,500,500,500,600,100,2,2,602,2,2,602,-515,-515,7,7,0,0],
                [100,100,600,600,600,600,600,600,600,600,602,602,602,0,0,0,0,0],
                [500,100,100,100,100,602,602,602,602,602,602,602,602,2,2,2,2,2,2,2,2,2,0,0]
                ];
var arr_shengshu=[
                  [1,1,1,1,1,1,1,1,1,1,1,1,1,1,5],
                  [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5],
                  [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,10],
                  [1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,10,10,10],
                  [1,1,1,1,1,1,1,1,1,1,1,1,1,10,10,10,10,10,10,10],
                  [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,10,10,10,10,10],
                  [1,1,1,1,1,5,10,10,10,10,10,10,10,10,10,10,10,10],
                  
                  [1,1,1,1,1,1,1,10,5,10,10,10,10,10,10,10,10,10,10,10,10],
                  [5,5,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10],
                  [1,5,5,5,5,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]
                  ];

var arr_mubiaofenshu=[650,1235,2130,3335,4850,6675,8810,11255,14010,17075];

//第一关参数
var chang=768;
var kuang=700;


var targetGouDao=-1;



var GameCenterLayer = cc.Layer.extend({
	gamecenter:null,//单例
	gameLevel:0,
	gameTime:0,
	gameScore:0,
	
	sprite:null,
	sp_gouzhi:null,
	sp_gouzhi1:null,
	sp_jinzhi1:null,
	sp_Hero:null,
	mc_Hero:null,
	sp_Bomb:null,
	mc_Bomb:null,
	sp_Up:null,
	sp_Down:null,
	sp_JianTou:null,
	i_countNum:0,
	mc_jizhi1:null,
	sp_jizhi1:null,
	mc_jizhi2:null,
	sp_jizhi2:null,
	mc_jizhi3:null,
	sp_jizhi3:null,
	mc_jizhi4:null,
	sp_jizhi4:null,
	bb_Moving:false,
	txt_Money:null,
	txt_Target:null,
	txt_Time:null,
	txt_Level:null,
	test_1:null,
	test_2:null,
	test_3:null,
	test_4:null,
	btn_LeiGuan:null,
	txt_CaiDai:null,
	
	
	txt_Ts:null,
	totalTime:0,
	bb_isTimeOut:false,
	num_leiguanX:0,
	num_leiguanY:0,
	ctor:function () {
		//////////////////////////////
		// 1. super init first
		this._super();

		/////////////////////////////
		// 2. add a menu item with "X" image, which is clicked to quit the program
		//    you may modify it.
		// ask the window size
		var size = cc.winSize;
		kuang=700+size.height-1024;
		gamecenter=this;
		gameLevel=g_Value_gameLevel;
		gameTime=g_Value_gameTime;
		gameScore=g_Value_gameScore;
		totalTime=0;
		arrKuangWu=[];
		arrMouse=[];
		this.bb_isTimeOut=false;
		var mainScene=ccs.load(res.gamecenter_json).node;
		this.addChild(mainScene);
//		sp_gouzhi=mainScene.getChildByName("sp_GouZhi");
//		sp_gouzhi.setVisible(false);
		
		sp_Hero=mainScene.getChildByName("sp_Hero");
		mc_Hero=ccs.load(res.mcHero_json).action;
		mainScene.runAction(mc_Hero);
		mc_Hero.gotoFrameAndPause(0);
		sp_Hero.y+=size.height-1024;
		
		sp_Bomb=mainScene.getChildByName("sp_Bomb");
		mc_Bomb=ccs.load(res.effectBomb_json).action;
		mainScene.runAction(mc_Bomb);
		mc_Bomb.gotoFrameAndPause(0);
		sp_Bomb.setScale(3, 3);
//		sp_jizhi1=mainScene.getChildByName("ProjectNode_1");
//		mc_jizhi1=ccs.load(res.mcJinQian1_json).action;
//		mainScene.runAction(mc_jizhi1);
//		mc_jizhi1.gotoFrameAndPlay(0,20,true);
//		
//		sp_jizhi2=mainScene.getChildByName("ProjectNode_2");
//		mc_jizhi2=ccs.load(res.mcJinQian2_json).action;
//		mainScene.runAction(mc_jizhi2);
//		mc_jizhi2.gotoFrameAndPlay(0,20,true);
//		
//		sp_jizhi3=mainScene.getChildByName("ProjectNode_3");
//		mc_jizhi3=ccs.load(res.mcJinQian3_json).action;
//		mainScene.runAction(mc_jizhi3);
//		mc_jizhi3.gotoFrameAndPlay(0,20,true);
//		
//		sp_jizhi4=mainScene.getChildByName("ProjectNode_4");
//		mc_jizhi4=ccs.load(res.mcJinQian4_json).action;
//		mainScene.runAction(mc_jizhi4);
//		mc_jizhi4.gotoFrameAndPlay(0,20,true);
		//this.gotof
		this.txt_CaiDai=mainScene.getChildByName("Text_5");
		this.btn_LeiGuan=mainScene.getChildByName("Button_1");
		this.btn_LeiGuan.setVisible(false);
		this.txt_CaiDai.setVisible(false);
		this.txt_CaiDai.y+=size.height-1024;
		this.btn_LeiGuan.y+=size.height-1024;
		this.num_leiguanX=this.btn_LeiGuan.x;
		this.num_leiguanY=this.btn_LeiGuan.y;
		if(g_Array_DaoJu[0]==1){
			this.btn_LeiGuan.setVisible(true);
		}
		this.btn_LeiGuan.addTouchEventListener(this.backClicks);
		
		sp_Up=mainScene.getChildByName("sp_Top");
		sp_Up.y=size.height;
		sp_Down=mainScene.getChildByName("sp_Dowm");
		sp_Down.height=824+size.height-1024;
		
		var nnn=gameLevel%3+1;
		sp_Up.loadTexture(res["top"+nnn+"_png"]);
		sp_Down.loadTexture(res["down"+nnn+"_png"]);
		
		sp_JianTou=mainScene.getChildByName("sp_JianTou");
		sp_JianTou.y=864+size.height-1024;
		
		txt_Money=mainScene.getChildByName("top1_txt");
		txt_Target=mainScene.getChildByName("top2_txt");
		txt_Time=mainScene.getChildByName("top3_txt");
		txt_Level=mainScene.getChildByName("top4_txt");
		
		txt_Money.y+=size.height-1024;
		txt_Target.y+=size.height-1024;
		txt_Time.y+=size.height-1024;
		txt_Level.y+=size.height-1024;
		
		test_1=mainScene.getChildByName("Text_1");
		test_2=mainScene.getChildByName("Text_2");
		test_3=mainScene.getChildByName("Text_3");
		test_4=mainScene.getChildByName("Text_4");
		test_1.y+=size.height-1024;
		test_2.y+=size.height-1024;
		test_3.y+=size.height-1024;
		test_4.y+=size.height-1024;
		
		
		
		txt_Ts=new addNumberSprite();
		this.addChild(txt_Ts, 5);
		txt_Money.setString(gameScore);
		txt_Target.setString(arr_mubiaofenshu[gameLevel-1]);
		txt_Time.setString(gameTime);
		txt_Level.setString(gameLevel);
		//this.addTouchEventListener(this.backClick);
		
		//sp_Down=ccui.helper.seekWidgetByName(mainScene, "sp_Dowm");
		//sp_Down.addTouchEventListener(this.backClick);
		
//		sp_Hero1.setVisible(false);
		i_countNum=0;
		this.scheduleUpdate();
		
		
		sp_gouzhi1=new GZSprite();
		sp_gouzhi1.setPosition(sp_Hero.x, sp_Hero.y);
		this.addChild(sp_gouzhi1, 3);
		
//		sp_jinzhi1=new KuangWuSprite(500,1,1,0.5);
//		sp_jinzhi1.setPosition(100, 200);
//		this.addChild(sp_jinzhi1, 2);
		this.createKuangWu();
		
		var eventListener = cc.EventListener.create({
			event: cc.EventListener.TOUCH_ONE_BY_ONE,
			swallowTouches: true,
			onTouchBegan: this.onTouchBegan});
		cc.eventManager.addListener(eventListener, this);
		cc.log("123456");
		bb_Moving=false;
		
		var userinfo=new UserInfo();
		userinfo.setPosition(384,990+size.height-1024);
		this.addChild(userinfo, 30);
		
		//cc.audioEngine.stopAllEffects();
		//cc.audioEngine.playEffect(res.snd_bn, true);
		cc.audioEngine.playMusic(res.snd_bn, false);
		
		return true;
		
		
	},
	
	backClicks:function(sender,type)
	{
		switch (type) {        
		//pageView当前所在的page的index发生了变化。
		case ccui.Widget.TOUCH_ENDED:
//			helloworldl.resetItems(0);
			//cc.director.runScene(new GameCenterScene());
			gamecenter.onBomb();
			break;        
		default:  break;
		}
	},
	gameOver:function(){
		targetGouDao=-1;
		gamecenter.bb_isTimeOut=true;
		g_Value_gameScore=gameScore;
		g_Array_DaoJu=[];
		arrKuangWu=[];
		cc.director.runScene(new EndPageScene());
	},
	passGame:function(){
		targetGouDao=-1;
		gamecenter.bb_isTimeOut=true;
		g_Value_gameLevel++;
		g_Array_DaoJu=[];
		arrKuangWu=[];
		g_Value_gameScore=gameScore;
		if(g_Value_gameLevel>=arr_mubiaofenshu.length) 
		{
			gamecenter.gameOver();
			return;
		}
		
		cc.director.runScene(new ShopPageScene());
	},
	addScore:function(value){
		gameScore+=value;
		txt_Money.setString(gameScore);
	},
	createKuangWu:function(){

		//cc.log("jjj",arr_jiazhi.length,arr_shengshu.length,arr_zhonglei.length,arr_daxiao.length);
		for (var i = 0; i < arr_zhonglei[gameLevel-1].length; i++) {
			//cc.log("9999",arr_jiazhi[i],arr_shengshu[i],arr_zhonglei[i],arr_daxiao[i]);
			var sp_temp=new KuangWuSprite(arr_jiazhi[gameLevel-1][i],arr_shengshu[gameLevel-1][i],arr_zhonglei[gameLevel-1][i],arr_daxiao[gameLevel-1][i]);
			//sp_temp.setPosition(100*i+50, 200);
			gamecenter.setSPposition(sp_temp);
			arrKuangWu.push(sp_temp);
			this.addChild(sp_temp, 2); 
		}
	},
	setSPposition:function(sp){
//		var dollRect = sprite.getBoundingBox();  
//		var dollHeadRect = this.catchHand.getBoundingBox();  
//		if(cc.rectIntersectsRect(dollRect, dollHeadRect)){  
//			//发生碰撞事件  
//		}  
		//this.getContentSize().width

		var pangduan=true;
		
		while(pangduan){
			pangduan=false;
			var numX=Math.random()*(chang-sp.getContentSize().width)+sp.getContentSize().width/2;
			var numY=Math.random()*(kuang-sp.getContentSize().height)+sp.getContentSize().height/2;
			sp.setPosition(numX, numY);
			var dollRect = sp.getBoundingBox(); 
			
			for (var i = 0; i < arrKuangWu.length; i++) {
				var dollHeadRect = arrKuangWu[i].getBoundingBox(); 
				if(cc.rectIntersectsRect(dollRect, dollHeadRect)){  
					pangduan=true;
				}  
			}
		}
		
	},
	
	
	backClick:function(sender,type)
	{
		//if(!bbGameStart) return;
		switch (type) {        
		//pageView当前所在的page的index发生了变化。
		case ccui.Widget.TOUCH_ENDED:
			cc.log("PageView Event Turning");

			break;        
		default:  break;
		}
	},
	update:function(dt){
		if(gamecenter.bb_isTimeOut) return;
		totalTime += dt;
		if(totalTime>1){
			totalTime -=1;
			gameTime--;
			txt_Time.setString(gameTime);
			if (gameTime==0) {
				if(gameScore>arr_mubiaofenshu[gameLevel-1]){
					gamecenter.passGame();
				}else{
					gamecenter.gameOver();					
				}
				return;
			}
		}
		sp_gouzhi1.update(1);
		sp_gouzhi1.x=sp_Hero.x;
		i_countNum++;
		if(i_countNum==600){
			sp_JianTou.setVisible(false);
		}
		if(sp_gouzhi1.getStatus()==g_Status_Shut){
			if(sp_gouzhi1.getShifouzhuazhu()==0){
				if(sp_gouzhi1.getFanXiang2()==1){
					var dollRectGZ = sp_gouzhi1.getGouZhiRect();
	//				cc.log("width=",dollRectGZ.width);
					for (var i = 0; i < arrKuangWu.length; i++) {
						var dollHeadRect2 = arrKuangWu[i].getBoundingBox(); 
						if(cc.rectIntersectsRect(dollRectGZ, dollHeadRect2)){ 
							sp_gouzhi1.setShifouzhuazhu(1);
							targetGouDao=i;
							if (arrKuangWu[i].zhonglei==7) {
								gamecenter.onBombEffect();
								break;
							}
							arrKuangWu[targetGouDao].setStatus();
							//大力水
							sp_gouzhi1.setShengShu((g_Array_DaoJu[1]==1)?10:arrKuangWu[i].getShengshu());
							//优质钻石
							if (((arrKuangWu[i].zhonglei==5)||(arrKuangWu[i].zhonglei==4))&&(g_Array_DaoJu[4]==1)) {
								arrKuangWu[i].setJiaZhi(arrKuangWu[i].getJiaZhi()+200);
							}
							//石头书
							if ((arrKuangWu[i].zhonglei==2)&&(g_Array_DaoJu[3]>=1)) {
								if(Math.random()>0.5){
									arrKuangWu[i].setJiaZhi(100);
									g_Array_DaoJu[3]--;
								}								
							}
							break;
						}
					}
				}
			}else{
//				cc.log("jjjjj=",targetGouDao);
				var arrdd=sp_gouzhi1.getGouZhiPosition();
				arrKuangWu[targetGouDao].setPosition(arrdd[0], arrdd[1]);
				
			}
		}else{
			if(targetGouDao!=-1){
				var tempSp=arrKuangWu[targetGouDao];

				txt_Ts.x=tempSp.x;
				txt_Ts.y=tempSp.y;
				if(tempSp.getZhongLei()==3){
					tempSp.setJiaZhi(gamecenter.onFuDai());
				}
				if (tempSp.getZhongLei()==8) {
					mc_Hero.play("end",false);
					txt_Ts.setValue(tempSp.getJiaZhi());
				}else{
					txt_Ts.setValue("+"+tempSp.getJiaZhi());
				}
				cc.audioEngine.playMusic(res.snd_right, false);
				gamecenter.addScore(tempSp.getJiaZhi());
				tempSp.runAction(
						cc.sequence(
								cc.spawn(cc.scaleTo(1,1.3).easing(cc.easeIn(1.5)),cc.fadeOut(0.5)),
								cc.callFunc(function(){ 
									this.removeFromParent(true);
									txt_Ts.x=-100;
									},tempSp)
						)
				);
				
				
				
				
				//arrKuangWu[targetGouDao].removeFromParent(true);
//				cc.log("arrKuangWu.length=",arrKuangWu.length);
				
				arrKuangWu.splice(targetGouDao, 1);
				
//				cc.log("arrKuangWu.length=",arrKuangWu.length);
				targetGouDao=-1;
			}
			
		}

		for (var j = 0; j < arrKuangWu.length; j++) {
			if ((arrKuangWu[j].zhonglei==5)||(arrKuangWu[j].zhonglei==6)){
				arrKuangWu[j].update(1);
			}
		}
	},
	baozhahanshu:function(tempSp){
		var xwei=tempSp.x;
		var ywei=tempSp.y;
		if (arrKuangWu.length>0) {
			var baozhashuzhu=[];
			//爆破数组
			for (var i=1; i<=arrKuangWu.length; i++)
			{
				var xjuli = xwei - arrKuangWu[i - 1].x;
				var yjuli = ywei - arrKuangWu[i - 1].y;
				var juli = xjuli * xjuli + yjuli * yjuli;
				if (juli<220*220)
				{						
					if(arrKuangWu[i-1].zhonglei!=7){
						if ((arrKuangWu.zhonglei==5)||(arrKuangWu.zhonglei==6))
						{
							//zuoye_kuanqu.kuanchang[i-1].xiaoshijian();
						}//假如得到的矿物为老鼠时，移除事件;						
						baozhashuzhu.push(i-1);
						//存入爆破数组
					}else{							
						//var fssj1:baozhashijian = new baozhashijian(baozhashijian.BAOZHA,i-1);
					 	//this.dispatchEvent(fssj1);
					}//假如被炸药炸到的是其它炸药时，继续触发爆炸事件
				}
			}
			if(baozhashuzhu.length>0){
				var zhizheng=0;
				for(var j=1;j<=baozhashuzhu.length;j++){
					var num=baozhashuzhu[j-1]-zhizheng;					
					arrKuangWu[num].removeFromParent(true);
					arrKuangWu.splice(num, 1);
					zhizheng++;
				}
			}
		}
	},//消除炸药周围半径为220的任何矿物;
	//炸药筒效果,
	onBombEffect:function(){
		if(targetGouDao!=-1){
			var tempSp=arrKuangWu[targetGouDao];
			sp_Bomb.x=tempSp.x;
			sp_Bomb.y=tempSp.y;
			mc_Bomb.play("playEffect",false);
			
			arrKuangWu.splice(targetGouDao, 1);
			
			gamecenter.baozhahanshu(tempSp);
			
			tempSp.removeFromParent(true);
//			cc.log("arrKuangWu.length=",arrKuangWu.length);
			targetGouDao=-1;

			sp_gouzhi1.setShifouzhuazhu(0);
			sp_gouzhi1.setFanXiang2();
			//大力水
			sp_gouzhi1.setShengShu(20);

			gamecenter.btn_LeiGuan.setVisible(false);
			cc.audioEngine.playMusic(res.snd_bomb, false);
		}
	},
	//炸弹效果
	onBomb:function(){
		if(targetGouDao!=-1){
			var tempSp=arrKuangWu[targetGouDao];

			
			//arrKuangWu[targetGouDao].removeFromParent(true);
//			cc.log("arrKuangWu.length=",arrKuangWu.length);
			var actionMoveDones=cc.CallFunc.create(function(node){
				gamecenter.btn_LeiGuan.x=gamecenter.num_leiguanX;
				gamecenter.btn_LeiGuan.y=gamecenter.num_leiguanY;
				gamecenter.btn_LeiGuan.setVisible(false);
				gamecenter.btn_LeiGuan.setScale(1, 1);
			},this);
			gamecenter.btn_LeiGuan.setScale(0.5, 0.5);
			var moveTos=cc.moveTo(0.07, cc.p(tempSp.x, tempSp.y));
			gamecenter.btn_LeiGuan.runAction(
					cc.sequence(
							moveTos,
							actionMoveDones
					)
			);
			
			
			
			tempSp.removeFromParent(true);
			arrKuangWu.splice(targetGouDao, 1);
//			cc.log("arrKuangWu.length=",arrKuangWu.length);
			targetGouDao=-1;
			
			sp_gouzhi1.setShifouzhuazhu(0);
			//大力水
			sp_gouzhi1.setShengShu(20);
			
			//gamecenter.btn_LeiGuan.setVisible(false);
			

			
			
			
		}
	},
	//福袋效果
	onFuDai:function(){
		var gailv=Math.floor(10*Math.random());
		var qianbi=10;
		if(g_Array_DaoJu[2]==0){
			if(gailv<5){
				qianbi=Math.floor(Math.random()*500)+100;
				gamecenter.txt_CaiDai.setString("金钱：" + qianbi);
				
			}else if(gailv<8){
				gamecenter.btn_LeiGuan.setVisible(true);
				gamecenter.txt_CaiDai.setString("雷管");
			}else{
				gamecenter.txt_CaiDai.setString("生力水");
				g_Array_DaoJu[1]=1;

			}
		}else{
			if(gailv<4){
				qianbi=Math.floor(Math.random()*800)+200;
				gamecenter.txt_CaiDai.setString("金钱：" + qianbi);
			}else if(gailv<6){
				gamecenter.btn_LeiGuan.setVisible(true);
				gamecenter.txt_CaiDai.setString("雷管");
			}else if(gailv<8){
				gamecenter.txt_CaiDai.setString("生力水");
				g_Array_DaoJu[1]=1;

			}else{
				gamecenter.txt_CaiDai.setString("优质钻石");
				g_Array_DaoJu[4]=1;
			}
		}
		gamecenter.txt_CaiDai.stopAllActions();
		gamecenter.txt_CaiDai.setVisible(true);
		gamecenter.txt_CaiDai.runAction(
				cc.sequence(
						cc.delayTime(3),
						cc.fadeOut(0.5)
				)
		);
		return qianbi;
	},
	onTouchBegan:function(touch, event){
//		cc.log("PageView Event Turning",sp_gouzhi1.mm_Status);
		if(gamecenter.bb_isTimeOut) return false;
		var pos=touch.getLocation();
		//cc.log("ppp=",pos.x,pos.y);
		var actionMoveDone=cc.CallFunc.create(function(node){
			mc_Hero.gotoFrameAndPause(0);
			bb_Moving=false;
		},this);
		if(pos.y<(WINSIZE.height-210)){
			if(sp_gouzhi1.getStatus()==g_Status_Normal){
				cc.audioEngine.playMusic(res.snd_shut, false);
				sp_gouzhi1.setStatus(g_Status_Shut);
			}
		}else{
			if((!bb_Moving)&&(sp_gouzhi1.getStatus()==g_Status_Normal)){
				bb_Moving=true;
				var moveTo=cc.moveTo(Math.abs(pos.x-sp_Hero.x)/300, cc.p(pos.x, sp_Hero.y));
				sp_Hero.runAction(
							cc.sequence(
								moveTo,
								actionMoveDone
							)
						);
				mc_Hero.play("move",true);
			}
		}
		
		return false;
	}
});



var GameCenterScene = cc.Scene.extend({
	onEnter:function () {
		this._super();
		var layer = new GameCenterLayer();
		this.addChild(layer);
	}
});

